import http from './http'


// ------ 首页 ---------------

/**
 * 获取运营服务
 */
export function getService(data = {}) {
	return http({
		url: '/api/operator/getService',
		// identity: 'user',
		data
	})
}

// 订阅消息模板  post   127.0.0.1:8080/api/operateConfig/getInfoByAppId?appId=wxec1dcddfa22c77c4 
export function getInfoByAppId(data = {}) {
	return http({
		url: '/api/operateConfig/getInfoByAppId',
		identity: 'user',
		data
	})
}
// 租电--下次再取接口 
export function nextTake(data = {}) {
	return http({
		url: '/api/device/nextTake',
		identity: 'user',
		data
	})
}

/**
 * 地图设备
 */
export function mapList(data = {}) {
	return http({
		url: '/api/operator/mapList',
		// identity: 'user',
		data
	})
}

/**
 * 地图设备-详情
 */
export function getDeviceDetail(data = {}) {
	return http({
		url: '/api/operator/getDeviceDetail',
		// identity: 'user',
		data
	})
}

/**
 * 购买（续费）套餐（换电）
 */
export function buyMeal(data = {}) {
	return http({
		url: '/api/mealExchange/buyMeal',
		identity: 'user',
		data
	})
}

/**
 * 提前结束套餐（换电）
 */
export function endMeal(data = {}) {
	return http({
		url: '/api/mealExchange/endMeal',
		identity: 'user',
		data
	})
}





// ------  换电柜 -----------

/**
 * 扫一扫
 */
export function scanDevice(data = {}) {
	return http({
		url: '/api/device/scan',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 查询用户当前的套餐（已购买且有效的）
 */
export function getMyMeal(data = {}) {
	return http({
		url: '/api/userMeal/getMyMeal',
		identity: 'user',
		data
	})
}

/**
 * 换电设备套餐列表+押金详情
 */
export function getDeviceMeal(data = {}) {
	return http({
		url: '/api/mealExchange/getDeviceMeal',
		// identity: 'user',
		data
	})
}

/**
 * 换电租赁电池须知+租赁电池套餐协议
 */
export function settingExchange(data = {}) {
	return http({
		url: '/api/settingExchange/getInfo',
		identity: 'user',
		data
	})
}

/**
 * 开门
 */
export function openDoor(data = {}) {
	return http({
		url: '/api/device/openDoor',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 重新开门
 */
export function restartOpen(data = {}) {
	return http({
		url: '/api/device/restartOpen',
		identity: 'user',
		default: true,
		data
	})
}


/**
 * 换电订单列表
 */
export function exchangeOrder(data = {}) {
	return http({
		url: '/api/orderExchange/list',
		identity: 'user',
		data
	})
}

/**
 * 换电订单详情
 */
export function exchangeOrderDetail(data = {}) {
	return http({
		url: '/api/orderExchange/getDetail',
		identity: 'user',
		data
	})
}


// ------  充电柜 -----------

/**
 * 充电充电使用须知+占仓扣费说明
 */
export function settingCharge(data = {}) {
	return http({
		url: '/api/settingCharge/getInfo',
		identity: 'user',
		data
	})
}

/**
 * 开启仓门-充电
 */
export function openDoorChr(data = {}) {
	return http({
		url: '/api/deviceChr/openDoorChr',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 重新开门
 */
export function reOpenChr(data = {}) {
	return http({
		url: '/api/deviceChr/reOpenChr',
		identity: 'user',
		data
	})
}


/**
 * 取消订单
 */
export function cancelChrOrder(data = {}) {
	return http({
		url: '/api/deviceChr/cancelChrOrder',
		identity: 'user',
		data
	})
}


/**
 * 充电订单列表
 */
export function orderCharge(data = {}) {
	return http({
		url: '/api/orderCharge/list',
		identity: 'user',
		data
	})
}

/**
 * 订单详情
 */
export function orderChargeDetail(data = {}) {
	return http({
		url: '/api/orderCharge/getDetail',
		identity: 'user',
		data
	})
}


/**
 * 结束充电
 */
export function endCharge(data = {}) {
	return http({
		url: '/api/orderCharge/endCharge',
		identity: 'user',
		data
	})
}

/**
 * 支付取电
 */
export function payAndGet(data = {}) {
	return http({
		url: '/api/orderCharge/payAndGet',
		identity: 'user',
		default: true,
		data
	})
}



// --------  扫码租车 -------------

/**
 * 设备和站点信息
 */
export function getDeviceByDeviceNo(data = {}) {
	return http({
		url: '/api/device/getDeviceByDeviceNo',
		identity: 'user',
		data
	})
}

/**
 * 查询当前设备代理商或运营商租车套餐列表
 */
export function getListMealRentByDeviceNo(data = {}) {
	return http({
		url: '/api/mealRent/getListMealRentByDeviceNo',
		identity: 'user',
		data
	})
}

/**
 * 判断用户可否下租车单
 */
export function judgeCanRentCar(data = {}) {
	return http({
		url: '/api/userRent/judgeCanRentCar',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 购买/续期当前代理商/运营商换电套餐并下租车单
 */
export function purchaseMealOrder(data = {}) {
	return http({
		url: '/api/mealOrder/purchaseMealOrder',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 汽车押金/租车电池押金预支付订单
 */
export function chargeDepositMakeOrder(data = {}) {
	return http({
		url: '/api/depositOrder/chargeDepositMakeOrder',
		identity: 'user',
		data
	})
}

/**
 * 获取设备当前代理商或运营商租赁协议
 */
export function getRentCarContract(data = {}) {
	return http({
		url: '/api/settingRent/getRentCarContract',
		identity: 'user',
		data
	})
}

/**
 * 订单列表（租车）
 */
export function rentCarOrder(data = {}) {
	return http({
		url: '/api/orderRent/list',
		identity: 'user',
		data
	})
}

/**
 * 租车订单详情
 */
export function rentCarOrderDetail(data = {}) {
	return http({
		url: '/api/orderRent/getDetail',
		identity: 'user',
		data
	})
}

/**
 * 归还车辆
 */
export function returnCar(data = {}) {
	return http({
		url: '/api/orderRent/returnCar',
		identity: 'user',
		default: true,
		data
	})
}



// -------- 个人中心 -------------

/**
 * 用户信息查询
 */
export function getUserInfo(data = {}) {
	return http({
		url: '/api/user/getInfo',
		identity: 'user',
		data
	})
}

/**
 * 更新用户信息
 */
export function editUserInfo(data = {}) {
	return http({
		url: '/api/user/edit',
		identity: 'user',
		data
	})
}

// 支付测试
export function payLakalcs(data) {
	return http({
		url: 'https://change.yunheznkj.com/api/pay/lakalcs',
		identity: 'user',
		data
	})
}



/**
 * 退出登录-删除token缓存
 */
export function logout(data = {}) {
	return http({
		url: '/api/user/logout',
		identity: 'user',
		data
	})
}


/**
 * 我的电池
 */
export function getMyBattery(data = {}) {
	return http({
		url: '/api/battery/getMyBattery',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 获取钱包信息（余额与押金）
 */
export function getBalance(data = {}) {
	return http({
		url: '/api/user/getBalance',
		identity: 'user',
		data
	})
}


/**
 * 我的钱包 - 订单明细
 */
export function tradeRecord(data = {}) {
	return http({
		url: '/api/tradeRecord/list',
		identity: 'user',
		data
	})
}



/**
 * 押金明细
 */
export function depositOrder(data = {}) {
	return http({
		url: '/api/depositOrder/list',
		identity: 'user',
		data
	})
}

/**
 * 押金提现
 */
export function depositWithdraw(data = {}) {
	return http({
		url: '/api/depositOrder/withdraw',
		identity: 'user',
		data
	})
}


/**
 * 充值套餐列表
 */
export function mealList(data = {}) {
	return http({
		url: '/api/settingTopUp/list',
		identity: 'user',
		data
	})
}

/**
 * 充值
 */
export function recharge(data = {}) {
	return http({
		url: '/api/settingTopUp/createRechargeOrder',
		identity: 'user',
		data
	})
}

/**
 * 我的ic卡列表
 */
export function icList(data = {}) {
	return http({
		url: '/api/ic/icList',
		identity: 'user',
		data
	})
}

/**
 * 绑定ic卡
 */
export function icBind(data = {}) {
	return http({
		url: '/api/ic/icBind',
		identity: 'user',
		data
	})
}

/**
 * 注销卡号
 */
export function icCancel(data = {}) {
	return http({
		url: '/api/ic/icCancel',
		identity: 'user',
		data
	})
}

/**
 * 添加意见反馈
 */
export function feedBack(data = {}) {
	return http({
		url: '/api/feedback/addFeedback',
		identity: 'user',
		data
	})
}